﻿using Prism.Commands;
using Prism.Events;
using Prism.Regions;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZoneLineNew.Services.DB;
using ZoneLineNew.Services.Message;
using ZoneLineNew.ViewModelBase;

namespace ZoneLineNew.ViewModels.Dialogs {

    public class AuthDialogViewModel : DialogViewModel {

        public AuthDialogViewModel(
            IRegionManager regionManager,
            IDialogService dialog,
            IEventAggregator eventAggregator, 
            IMessageService message, 
            IDbOperate<IFreeSqlMainContext> mainDbOperate) 
            : base(regionManager, dialog, eventAggregator, message, mainDbOperate) {

        }

        #region Props
        
        private string _password;

        public string Password {
            get { return _password; }
            set { _password = value; base.RaisePropertyChanged(); }
        }

        #endregion


        public DelegateCommand ConfirmCommand => new DelegateCommand(() => {
            if (Password != "142536") {
                _message.Warning("密码错误！");
                return;
            }
            DialogResult dialogResult = new DialogResult(ButtonResult.OK);
            base.OnDialogClosed(dialogResult);
        });

        public DelegateCommand CancelCommand => new DelegateCommand(() => {
            base.OnDialogClosed(ButtonResult.Cancel);
        });


        protected override void OnViewLoaded() {
            base.OnViewLoaded();
        }








    }
}
